import request from '@/utils/request'

const api_name = '/system/sysUser'

export default {
  /**
   * 分页查询 用户
   */
  getPageList(pageNo, pageSize, searchObj) {
    return request({
      url: `${api_name}/getPageList/${pageNo}/${pageSize}`,
      method: 'get',
      params: searchObj
    })
  },
  /**
   * 根据id查询 用户
   */
  getById(id){
    return request({
      url: `${api_name}/${id}`,
      method: 'get'
    })
  },
  /**
   *  保存用户
   */
  save(user) {
    return request({
      url: `${api_name}/save`,
      method: 'post',
      data: user
    })
  },
  /**
   * 更新用户
   */
  update(user) {
    return request({
      url: `${api_name}/update`,
      method: 'put',
      data: user
    })
  },
  /**
   * 删除用户
   */
  deleteById(id) {
    return request({
      url: `${api_name}/delete/${id}`,
      method: 'delete'
    })
  },
  /**
   * 批量删除用户
   */
  deleteBatchById(ids) {
    return request({
      url: `${api_name}/deleteBatch`,
      method: 'delete',
      data: ids
    })
  },
  /**
   *  修改用户账号是否可用
   */
  updateStatus(id,status){
    return request({
      url: `${api_name}/status/${id}/${status}`,
      method: 'get'
    })
  }
}
